home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jaz_clib.arc / JZBACKGR.DMO < prev    next >
Text File  |  1989-04-09  |  3KB  |  128 lines

  1. #define INC 3
  2. #define TIMER 0x1c        /* timer interrupt          */
  3. #define COPYWRITE "JZBACKGR (C) JazSoft 1986 by Jack A. Zucker @ 301-794-5950 |\
  4.  CIS: 75766,1336"
  5. #define STATUSLINE "                           Press Esc to end program"
  6. #define MAXNOTES 33        /*  Number of notes in song */
  7. #define cESC "\001"
  8. #define ESCSCAN 1        /* scan code for escape code */
  9.  
  10. #include <jaz.h>
  11. #include <keys.h>
  12. #include <jzscreen.h>
  13.  
  14. int background();        /* play music in the background */
  15.  
  16. int jeopardy[] =        /* Welcome to jeopardy with Art Flemming */
  17. {
  18. 196,261,196,130,130,196,261,196,196,261,196,261,329,293,261,246,220,212,
  19. 196,261,196,130,130,196,261,196,261,220,196,174,164,146,130
  20. };
  21.  
  22. int delay[] = {         /* determines note value */
  23. 2,2,2,1,1,2,2,4,2,2,2,2,3,1,1,1,1,1,2,2,2,1,1,2,2,4,3,1,2,2,4,4,8
  24. };
  25.  
  26. main()
  27. {
  28.  
  29.   TVECTOR wvec;
  30.  
  31.   jzlogo();
  32.  
  33.   jzgetint(TIMER,&wvec);
  34.   jzinsint(TIMER,background);
  35.  
  36.   displayinfo();
  37.  
  38.   getinfo();
  39.  
  40.   soundoff();
  41.   jzsetint(TIMER,wvec);
  42.  
  43. }
  44.  
  45. #define FIRST 1
  46. #define LAST  6
  47. getinfo()
  48. {
  49.   int w = 1,wch;
  50.   char name[31],street[31],city[16],state[3],zip[6],phone[13];
  51.  
  52.   name[0] = 0;
  53.   street[0] = 0;
  54.   city[0] = 0;
  55.   state[0] = 0;
  56.   zip[0] = 0;
  57.   phone[0] = 0;
  58.  
  59.   do {
  60.     switch(w) {
  61.       case 1 : wch = jzinstr(name,30,5,8,(CYAN << 4) + BLUE,60L,cESC);
  62.            break;
  63.       case 2 : wch = jzinstr(street,30,6,8,(CYAN << 4) + BLUE,60L,cESC);
  64.            break;
  65.       case 3 : wch = jzinstr(city,15,7,8,(CYAN << 4) + BLUE,60L,cESC);
  66.            break;
  67.       case 4 : wch = jzinstr(state,2,8,8,(CYAN << 4) + BLUE,60L,cESC);
  68.            break;
  69.       case 5 : wch = jzinstr(zip,5,9,8,(CYAN << 4) + BLUE,60L,cESC);
  70.            break;
  71.       case 6 : wch = jzinstr(phone,12,10,8,(CYAN << 4) + BLUE,60L,cESC);
  72.            break;
  73.     }
  74.  
  75.     switch (wch) {
  76.       case CTRL_X :
  77.       case CTRL_M : w = min(LAST,w+1);
  78.             break;
  79.       case CTRL_E : w = max(FIRST,w-1);
  80.             break;
  81.       case PGDN   : w = LAST;
  82.             break;
  83.       case PGUP   : w = FIRST;
  84.             break;
  85.       case ESCSCAN: return;
  86.     }
  87.   } while (-1);
  88. }
  89.  
  90. displayinfo()
  91. {
  92.  
  93.   int w;
  94.  
  95.   cls(LIGHTGRAY);
  96.  
  97.   jzscrprn(COPYWRITE,0,2,MAGENTA);
  98.  
  99.   jzscrprn("Name  :",5,0,YELLOW); jzdspfld("",30,5,8,(CYAN << 4) + BLUE);
  100.   jzscrprn("Street:",6,0,YELLOW); jzdspfld("",30,6,8,(CYAN << 4) + BLUE);
  101.   jzscrprn("City  :",7,0,YELLOW); jzdspfld("",15,7,8,(CYAN << 4) + BLUE);
  102.   jzscrprn("State :",8,0,YELLOW); jzdspfld("",2,8,8,(CYAN << 4) + BLUE);
  103.   jzscrprn("Zip   :",9,0,YELLOW); jzdspfld("",5,9,8,(CYAN << 4) + BLUE);
  104.   jzscrprn("Phone :",10,0,YELLOW); jzdspfld("",12,10,8,(CYAN << 4) + BLUE);
  105.  
  106.   jzscrprn(STATUSLINE,24,2,GREEN);
  107.  
  108. }
  109.  
  110. background()
  111. {
  112.   static int w=0,wcount=0;
  113.  
  114.   if (w == MAXNOTES) w = 0;
  115.  
  116.   if (wcount == 0) soundon(jeopardy[w]);
  117.   else {
  118.     if (wcount == (INC * delay[w])) {
  119.       soundoff();
  120.       wcount = -1;
  121.       w ++;
  122.     }
  123.   }
  124.   wcount ++;
  125. }
  126.  
  127.  
  128.